﻿using LiveCharts;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Collections.ObjectModel;

namespace 通用过站与数采.ViewModel
{
    public class MainViewModel : Notify
    {
        private ObservableCollection<Item> _Items = new ObservableCollection<Item>() { };
        public ObservableCollection<Item> Items
        {
            get => _Items;
            set { _Items = value; RaisePropertyChanged("Items"); }
        }
        private ChartValues<int> _Pass = new ChartValues<int> { 0 };
        public ChartValues<int> Pass
        { get=>_Pass; set { _Pass = value;RaisePropertyChanged("Pass"); } }

        private ChartValues<int> _Fail = new ChartValues<int> { 0 };
        public ChartValues<int> Fail
        { get => _Fail; set { _Fail = value; RaisePropertyChanged("Fail"); } }

        private ChartValues<int> _Wait = new ChartValues<int> { 0 };
        public ChartValues<int> Wait
        { get => _Wait; set { _Wait = value; RaisePropertyChanged("Wait"); } }
        private Visibility _JiWeiVisible = Visibility.Hidden;
        public Visibility JiWeiVisible
        { get => _JiWeiVisible; set { _JiWeiVisible = value;RaisePropertyChanged("Visible"); } }
        private Visibility _GongXuVisible = Visibility.Hidden;
        public Visibility GongXuVisible
        { get => _GongXuVisible; set { _GongXuVisible = value; RaisePropertyChanged("Visible"); } }
        private bool _Enable = false;
        public bool Enable
        { get => _Enable; set { _Enable = value;RaisePropertyChanged("Enable"); } }

        public class Item : Notify
        {
            int _No;

            public int No
            {
                get { return _No; }
                set { _No = value; RaisePropertyChanged("No"); }
            }
            string _MoCode;

            public string MoCode
            {
                get { return _MoCode; }
                set { _MoCode = value; RaisePropertyChanged("MoCode"); }
            }
            string _BarCode;

            public string BarCode
            {
                get { return _BarCode; }
                set { _BarCode = value; RaisePropertyChanged("BarCode"); }
            }

            string _Pk_id;

            public string Pk_id
            {
                get { return _Pk_id; }
                set { _Pk_id = value; RaisePropertyChanged("Pk_id"); }
            }

            SolidColorBrush _BackColor = new SolidColorBrush(Colors.LightGray);
            public SolidColorBrush BackColor
            {
                get { return _BackColor; }
                set { _BackColor = value; RaisePropertyChanged("BackColor"); }
            }
        }
    }
    public class Notify : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void RaisePropertyChanged(string propertyname)
        {
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
        }
    }

}
